/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entities;

import helpers.MyPoint;
import helpers.RandomGenerator;

/**
 *
 * @author arnaldo
 */
public class User {
    
    private String login;
    private String email;
    private String password;
    private int age;
    private int race;
    private MyPoint location;
    private int id;

    public User(){
        this.login = RandomGenerator.UserName();
        this.email = RandomGenerator.buildEmail(this.login);
        this.password = RandomGenerator.Password();
        this.age = RandomGenerator.Age();
        this.race = RandomGenerator.Race();
        this.location = RandomGenerator.Location();
    }

    public UserAnswers[] takeSurvey(Survey s){
        Question [] qs = s.getQuestions();
        UserAnswers[] ans = new UserAnswers[qs.length];

        for(int i=0;i<qs.length;i++){
            ans[i] = new UserAnswers();
            ans[i].setAnswer(RandomGenerator.Answer(qs[i].getAnswers().length));
            ans[i].setQuestion(qs[i]);
        }

        return ans;
    }

    @Override
    public String toString(){
        String str = "";

        str += "Login: "+this.getLogin()+"\n";
        str += "Email: "+this.getEmail()+"\n";
        str += "Password: "+this.getPassword()+"\n";
        str += "Age: "+this.getAge()+"\n";
        str += "Race: "+this.getRace()+"\n";
        str += "Location: "+this.getLocation()+"\n";

        return str;
    }

    /**
     * @return the login
     */
    public String getLogin() {
        return login;
    }

    /**
     * @param login the login to set
     */
    public void setLogin(String login) {
        this.login = login;
    }

    /**
     * @return the email
     */
    public String getEmail() {
        return email;
    }

    /**
     * @param email the email to set
     */
    public void setEmail(String email) {
        this.email = email;
    }

    /**
     * @return the password
     */
    public String getPassword() {
        return password;
    }

    /**
     * @param password the password to set
     */
    public void setPassword(String password) {
        this.password = password;
    }

    /**
     * @return the age
     */
    public int getAge() {
        return age;
    }

    /**
     * @param age the age to set
     */
    public void setAge(int age) {
        this.age = age;
    }

    /**
     * @return the race
     */
    public int getRace() {
        return race;
    }

    /**
     * @param race the race to set
     */
    public void setRace(int race) {
        this.race = race;
    }

    /**
     * @return the location
     */
    public MyPoint getLocation() {
        return location;
    }

    /**
     * @param location the location to set
     */
    public void setLocation(MyPoint location) {
        this.location = location;
    }

    /**
     * @return the id
     */
    public int getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(int id) {
        this.id = id;
    }

    
}
